<%--
 *  File:    ApprovalFailSummary.jsp
 *  @Author: Saraxia 
 *  Date:    2012/11/15
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into 
 *  with Oval. 
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.YearPlanApprovalFailSummary"); 
%>

<% //--------------------------------------  variant and initialization --%>
<%
    String strModuleName = "COM";
  	String strTableName = "";
  	
  	String privilegeCode = "FP030020,FP040020,FP050020,FP060020,FP070020,FP080020";
    String contextPath = request.getContextPath(); 
%>



<%
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<title>YearplanApprovalFailSummary</title>
<PageFlow:CheckPageFlow pageName="approvalfailyearplansummary"/>
<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector userGroupSummary = (Vector)pageContext.getAttribute("ugsummary");
  	if(userGroupSummary == null)
  	{
    	userGroupSummary = new Vector();
  	}
  	
  	
  	String subjectcode = (String)pageContext.getAttribute("subjectcode");
  	
  	String planlevel = "";
  	if(pageContext.getAttribute("planlevel") == null || "".equals(pageContext.getAttribute("planlevel").toString())){
  		planlevel = session.getAttribute("planlevel").toString();
  	}else{
  		planlevel = pageContext.getAttribute("planlevel").toString();
  	}
  	
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>



function page_clear(){
	document.getElementById("username").value="";
	document.getElementById("employeecode").value="";
	document.getElementById("employeename").value="";
    document.getElementById("deptid").options[0].selected=true;
	document.getElementById("batchnosearch").value="";
	document.getElementById("strareaname").value="";

}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(usergroupsummaryform,actionvalue,orderbyname);
  var subjectcode =usergroupsummaryform.subjectcode.value;
  editform.action = "YearPlanApprovalFailSummary.jsp?<%= OvalTools.randomURL() %>"+"&subjectcode="+subjectcode;
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}



function allcheckselect(){
	var allcheck = usergroupsummaryform.allcheck.checked;
	var alldatafile = document.getElementsByName('batchnostr');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

function page_update(){
	
	    if(isNullChecked(usergroupsummaryform.batchnostr))
	    {
	        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
	        return;
	    }
	    
		document.usergroupsummaryform.actionname.value = "update";
		document.usergroupsummaryform.target = "_self";
	    isRunning = true;
		document.usergroupsummaryform.submit();
}

function page_agree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "agree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_disagree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "disagree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_report(){
	
    if(isNullChecked(usergroupsummaryform.batchnostr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "report";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}
function page_approval()
{
var frm = document.usergroupsummaryform;
  frm.actionname.value = "approve";
  frm.target = "_self";
  isRunning = true;
  frm.submit();

}
function page_popBusinessarea()
{
  if (typeof popwindow != 'undefined') popwindow.close();
  popwindow = window.open("<%=contextPath%>/masterdata/ogm/zylstdbusinessareapop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}

function setContact(id,type,name){
	document.getElementById("stdareaid").value=id;
	document.getElementById("strareaname").value=name;
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<% //--------------------------------------  hidden form variant --%>
	<form name="usergroupsummaryform" method="post" action="<%=contextPath %>/Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="approvalfailyearplansummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="numrows" value="<%=userGroupSummary.size() %>">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="subjectcode" value="<%=subjectcode %>">
        <input type="hidden" name="planlevel" value="<%=planlevel %>">
 <%
    String strLanguageCode0;
    String strLanguageCode1; 
    if(strLanguageCode.equalsIgnoreCase("cn"))
    {
  	strLanguageCode0 = "cn";
  	strLanguageCode1 = "en";
    }else{
  	strLanguageCode0 = "en";
  	strLanguageCode1 = "cn";
    }
  %>
    <input type="hidden" name="languagecode0" value="<%= strLanguageCode0 %>">
  <input type="hidden" name="languagecode1" value="<%= strLanguageCode1 %>">
  <input type="hidden" name="languagecode2" value="<%= strLanguageCode0 %>">
  <input type="hidden" name="languagecode3" value="<%= strLanguageCode1 %>">
  <input type="hidden" name="entitytype0" value="NT">
  
  <input type="hidden" name="entitytype1" value="NT">
  <input type="hidden" name="entitytype2" value="NC">
  <input type="hidden" name="entitytype3" value="NC">
  <input type="hidden" name="content0">
  <input type="hidden" name="content1">
  <input type="hidden" name="content2">
  <input type="hidden" name="content3">
   <custom:hidden name="userinfo" property="orgid" scope="session"/>
    <custom:hidden name ="userinfo" property ="userid" scope="session" changedName="fromuserid"/>
    
   

	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
	
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
  	<tr> 
    	<td valign="top"> 
    		<table width="100%" border="0" cellspacing="0">
          	<tr><td class="summary_top" ></td></tr>
          	<tr><td style="text-align:right"><%= label.getLabelName("L_theYear") + label.getLabelName("L_plane_code") + label.getLabelName("L_Colon") %></td>
          		<td><custom:text property="batchnosearch"/></td>
             	<td style="text-align:right"><%= label.getLabelName("L_DefaultDeptName") + label.getLabelName("L_Colon") %></td>
				<td><custom:select optionInnerTextKey="deptname" optionsName="alldepts" property="deptid" defaultValue="------" optionValueKey="deptid"
				defaultValueCost=""/></td>
          	    <td style="text-align:right"><%= label.getLabelName("L_UserCode") + label.getLabelName("L_Colon") %></td><td><custom:text property="username"/></td>
			</tr>
			<tr>
		        <td style="text-align:right"><%= label.getLabelName("L_UserNumber") + label.getLabelName("L_Colon") %></td><td><custom:text property="employeecode"/></td>
				<td style="text-align:right"><%= label.getLabelName("L_UUserName") + label.getLabelName("L_Colon") %></td><td><custom:text property="employeename"/></td>
				<td style="text-align:right"><%= label.getLabelName("L_Provicetdr") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:hidden property="stdareaid" />
				<custom:text property="strareaname"/><a onclick="page_popBusinessarea();"><custom:button type="3" value="*"/></a>
				</td>
				<td colspan="2"><a href="javascript:page_summary('search')"><img src="/oval/images/cn/go_fy.gif" border="0" style="border: 1 solid #000000"></a>&nbsp;&nbsp;<button button type="button" onclick="page_clear()" class="button1" name="re" value="clear"><%= label.getLabelName("L_Clear") %></button></td>
          	</tr>
        	</table>
        </td>
   	</tr>
   	</table>
   
   	<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="0">
   
   	<% //--------------------------------------  summary header --%>
   	<tr bgcolor="#ACBCCA"  class="deepblue-left" > 
   		<td width="2%"  class="title_center" >&nbsp;</td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','yearplanapprovalcode')"><%= label.getLabelName("L_theYear") + label.getLabelName("L_plane_code") %></a></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_Status") %></a></td>

       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','employeename')"><%= label.getLabelName("L_SubmitUser") %></a></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_CreatDate") %></a></td>
</tr>

	<% //--------------------------------------  default value definition --%>
    <%
    	int i=1;
        Integer nDefaultbatchno = new Integer(-1);               
        String strClassType = new String(); 
        boolean bHasChecked = false;
        String strDefaultIsDisabled="";
        String strDefaultmdapprovalgroupname=""; 
        String nDefaultbatchcode = "";
   	%>
   	
    <% //--------------------------------------  loop results --%>
    <logic:iterate id="usergroup" collection="<%= userGroupSummary %>">                      
    	
    <%
    	HashMap userGroupMap = (HashMap)pageContext.getAttribute("usergroup"); 
        String strIsDisabled = "";
        String strIsChecked = "";
        if(i%2==0){
            strClassType="td-listrom";
        } else{
            strClassType="none";
        } 
       if(!bHasChecked)
        {
	        strIsChecked = "Checked";                       
            bHasChecked = true;
            nDefaultbatchno = (Integer)(userGroupMap.get("yearplanapprovalid"));
            nDefaultbatchcode = userGroupMap.get("yearplanapprovalcode")+"";
          	strDefaultIsDisabled = strIsDisabled;   
        }  
       i++;
  	%>
  	
  	
    <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"   class="<%=JspHelper.filterNull( strClassType )%>">
    	<td width="5%" class="title_center">
        	<input type = "radio" name="allcheck" class="normalradio" onclick="allcheckselect();" checked = "<%=strIsChecked %>">
        </td>
        <%if((JspHelper.filterNull( subjectcode ).equals("815")) || !("").equals(JspHelper.filterNull( subjectcode ))) {%>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<a href="ApprovalFailYearPlanDetail.jsp?<%= OvalTools.randomURL() %>&yearplanapprovalcode=<%=JspHelper.filterNull( userGroupMap.get("yearplanapprovalcode") )%>&dimension=<%=JspHelper.filterNull( userGroupMap.get("dimension") )%>&planlevel=<%=planlevel %>&subjectcode=<%=subjectcode %>"><%=JspHelper.filterNull( userGroupMap.get("yearplanapprovalcode") )%></a></td>
        <%}else{ %>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<a href="ApprovalFailYearPlanDetail.jsp?<%= OvalTools.randomURL() %>&yearplanapprovalcode=<%=JspHelper.filterNull( userGroupMap.get("yearplanapprovalcode") )%>&dimension=<%=JspHelper.filterNull( userGroupMap.get("dimension") )%>&planlevel=<%=planlevel %>"><%=JspHelper.filterNull( userGroupMap.get("yearplanapprovalcode") )%></a></td>
        <%} %>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("statusname") )%></td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("employeename") )%></td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("createdate") )%></td>
       
    </tr>
    </logic:iterate>  
    
    <% //--------------------------------------  default value --%>       
    <input type="hidden" name="transactionid" value="<%=JspHelper.filterNull( nDefaultbatchno )%>">
    <input type="hidden" name="transactioncode" value="<%=JspHelper.filterNull( nDefaultbatchcode )%>">
    <input type="hidden" name="planlevel" value="<%=JspHelper.filterNull( planlevel )%>">
           
    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
    </table>
    
    <% //--------------------------------------  page operation button --%>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr> 
        	<td class="summary_top" ></td>
        </tr>
		
        <tr> 
        	<td class="td_center">  
        	<%
        	if(JspHelper.filterNull( subjectcode ).equals("815")){
        	%>
			<a onclick="javascript:page_approval()" ><custom:button type="1" label="L_Check" imgsrc="save.gif" border="0" style="width:60"   /></a>
        	<%}else{ %>
        	
        	&nbsp;
        	<%} %>
        	</td>
        	
        </tr>
	
  	</table>

</form>
</body>
</html>


